import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home/Home.vue'

Vue.use(VueRouter)

const routes = [
  { //配置路由重定向
    path: "/",
    redirect: "/home"
  },
  {
    //首页
    path: '/home',
    name: 'Home',
    component: Home
  },
  {//分类
    path: '/category',
    name: 'Category',
    component: () => import('../views/Category/Category.vue')  //按需引入组件
  },
  {//购物车
    path: '/cart',
    name: 'Cart',
    component: () => import('../views/Cart/Cart.vue')  //按需引入组件
  },
  {//我的
    path: '/mine',
    name: 'Mine',
    component: () => import('../views/Mine/Mine.vue')  //按需引入组件
  }
]

const router = new VueRouter({
  routes
})

export default router
